package com.hengxinyongli.iam.filter.impl;

import com.hengxinyongli.iam.filter.PermitsValidateChain;
import com.hengxinyongli.iam.filter.PermitsFilter;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * @author magic
 * @date 2018/9/28/028 14:46
 * @version 1.0
 * Description SuperAdminFilter
 */
@Component
@Order(1)
public class SuperAdminFilter implements PermitsFilter {

    private static final String SUPER_PERMIT = "/*:*";

    @Override
    public void invoke(PermitsValidateChain chain,String uri,String method, Set<String> permits) {
        if (!permits.contains(SUPER_PERMIT)){
            chain.filter(uri,method,permits);
        }
    }

}
